package WaiBao;

import java.util.Arrays;

public class ZhaoXingXuan {
    public static void main(String[] args) {
        String[] name = {"王子轩(班长)","王一博(体育委员)", "小李(学习委员)","王浩伟(文艺委员)", "李亚鹏", "李贺", "李白", "李子园", "王大崔", "李天东", "王子阳", "唐嫣",
                "鹿晗", "黄子韬", "张艺兴", "五月天", "吴奇隆", "郭富城", "周润发", "梁朝伟", "张家辉", "景甜", "王子文", "杨颖", "孙俪", "邓超", "李晨", "周星驰",
                "欧阳娜娜", "赵梓翾(学生)"};//考生本人: 赵梓翾(学生)
        int[] age = {20, 21, 22, 19, 18, 21, 19, 22, 19, 19, 20, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 21, 18, 21, 21};//考生本人年龄:21

        double[] lv1 = {87, 92, 84, 90, 77, 69, 78, 89, 80, 80, 91, 87, 65, 88, 65, 68, 99, 79, 96, 78, 92, 91, 95, 65, 75, 74, 94, 74, 80, 96};
        double[] lv2 = {99, 75, 69, 76, 98, 77, 68, 62, 60, 70, 91, 77, 86, 95, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 85, 74, 81, 95};
        double[] lv3 = {61, 76, 84, 75, 77, 66, 71, 66, 80, 70, 93, 87, 85, 65, 65, 68, 69, 66, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 94};

        double dulu1;//代表每个学生的总分
        double dulu2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            dulu1 = lv1[i] + lv2[i] + lv3[i];
//            dulu2 = (dulu1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + dulu1);
//            System.out.println(name[i] + "的平均分为:" +dulu2);
//        }


        double tulu1 = 0, tulu2 = 0;
        double[] Arr = new double[30];
//        for (int i = 0; i < 30; i++) {
//            tulu1 = lv1[i] + lv2[i] + lv3[i];
//            tulu2 = (tulu1 * 1.0) / 3;
//            Arr[i] = tulu2;
//        }
//
//        for (int i = 0; i < Arr.length - 1; i++) {
//            for (int j = 0; j < Arr.length - i - 1; j++) {
//                if (Arr[j] < Arr[j + 1]) {
//                    double tep = Arr[j];
//                    Arr[j] = Arr[j + 1];
//                    Arr[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(Arr[i]);
//        }


        double pandas1 = 0, pandas2 = 0, pandas3 = 0;//计算每门课的平均分
        double huahua1 = 0,huahua2 = 0, huahua3 = 0;//计算每门课标准差
        double duka1 = 0, duka2 = 0,duka3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i <lv1.length; i++) {
            he +=lv1[i];
        }
        pandas1 = (he * 1.0) / 30;
        System.out.println("生物化学的班级平均分为:" + pandas1);
        double Sum = 0;
        for (int i = 0; i <lv2.length; i++) {
            Sum += lv2[i];
        }
        pandas2 = (Sum * 1.0) / 30;
        System.out.println("物理化学的班级平均分为:" + pandas2);
        double sum = 0;
        for (int i = 0; i < lv3.length; i++) {
            sum += lv3[i];
        }
        pandas3 = (sum * 1.0) / 30;
        System.out.println("电子与电工技术的班级平均分为:" + pandas3);


        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i < lv1.length; i++) {
            c1 += (lv1[i] - pandas1) *( lv1[i] - pandas1);
        }
        huahua1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:" + huahua1);
        for (int i = 0; i <lv2.length; i++) {
            c2 += (lv2[i] - pandas2) * (lv2[i] - pandas2);
        }
        huahua2 = Math.sqrt(c2*1.0/30);
        System.out.println("物理化学的班级标准差为:" + huahua2);

        for (int i = 0; i < lv3.length; i++) {
            c3 += (lv3[i] - pandas3) * (lv3[i] -pandas3);
        }
        huahua3 = Math.sqrt(c3*1.0/30);
        System.out.println("电子与电工技术的班级标准差为:" + huahua3);
//////
////
////
        Arrays.sort(lv1);
        Arrays.sort(lv2);
        Arrays.sort(lv3);
        duka1 = (lv1[14] + lv2[15]) * 1.0 / 2;
        duka2 = (lv2[14] +lv2[15]) * 1.0 / 2;
        duka3 = (lv3[14] + lv3[15]) * 1.0 / 2;
        System.out.println("生物化学的中位数为:" + duka1);
        System.out.println("物理化学的中位数为:" + duka2);
        System.out.println("电子与电工技术的中位数为:" + duka3);





    }
}
